require(["jquery","api","common"],function($,Api,Common){
  var qms = {
    config: {},
    $container: $(".formList"),
    _bindEvent: function () {
      this.$container.find(".grid").off("click","#grid-title-top").on("click","#grid-title-top",function(){
        var $this = $(this);
        window.location.href = "./new.html?urlType=HOMEPAGE";
      })
      this.$container.find(".grid").off("click","#grid-title").on("click","#grid-title",function(){
        var $this = $(this);
        var id = $this.attr("q_id");
        window.location.href = "./details.html?id=" + id + "&urlType=HOMEPAGE";
      })
      
    },
    _renderViewList: function () {
      var params = {
        type: "",
        status: "1",
        page: "1",
        lines: "9999",
        title: ""
      }
      var result = Api.getQusetionList(params);
      if(result.errcode == 0){
        var html = Common.template("card-tmpl",result.data)
        qms.$container.find(".grid").append(html);
        qms._bindEvent();
      }
    },
  }
  qms._renderViewList();
})